package com.learn.xueer.ui.activity

import android.os.Bundle
import android.text.Html
import com.learn.xueer.app.base.BaseActivity
import com.learn.xueer.databinding.ActivityProtocolBinding
import kotlinx.android.synthetic.main.activity_protocol.tv_content
import kotlinx.android.synthetic.main.activity_protocol.tv_title
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.util.ActivityMessenger
import me.hgj.jetpackmvvm.util.get

/**
 * 使用协议
 */
class ProtocolActivity : BaseActivity<BaseViewModel, ActivityProtocolBinding>() {
    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.click = ProxyClick()
        val data = intent.get<String>("data") ?: ""
        val name = intent.get<String>("name") ?: ""
        tv_title.text = name
        tv_content.text = Html.fromHtml(data)
    }

    inner class ProxyClick {

        fun agree() {
            ActivityMessenger.finish(this@ProtocolActivity, "data" to "agree")
        }

        fun disAgree() {
            ActivityMessenger.finish(this@ProtocolActivity, "data" to "disAgree")
        }

        fun back() {
            finish()
        }

    }
}